home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7005 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.9 KB  |  54 lines

  1. Path: sundog.tiac.net!tiac
  2. From: mathman@tiac.net
  3. Newsgroups: comp.lang.c
  4. Subject: Output problem for c student---Help needed
  5. Date: Sat, 17 Feb 1996 03:31:59 GMT
  6. Organization: The Internet Access Company
  7. Message-ID: <4g3j4a$6tc@sundog.tiac.net>
  8. Reply-To: mathman@tiac.net
  9. NNTP-Posting-Host: mathman.tiac.net
  10.  
  11. I have almost finished my first assignment. I am using BC++ Ver. 4.52.
  12. on Win95. The program is a simple load data calculate and print.
  13. The data is hours worked, clock number and wage. What the problem is:
  14. I can compile my program using makefile and it says success. Then a dos 
  15. window comes up with my first question. The program completes its 
  16. appointed loops fine. When I check the output file there is nothing 
  17. there. It looks like this.
  18. #include<stdio.h>
  19. main()
  20. {
  21.   int stuff;
  22.   float morestuff;
  23.    FILE *file_ptr;
  24.    file_ptr = fopen("out.txt","w");
  25.    
  26.       printf(first question);
  27.       scanf(stuff);
  28.        while(condition);
  29.        {
  30.           Enter the data in this section.
  31.      Then I have some 
  32.       fprintf(file_ptr,\n"--------------");
  33.       fprintf(file_ptr, "col. names");
  34.       fprintf(file_ptr,"-----------------");
  35.  
  36.        fprintf(file_ptr,"\n%6.0f",clock_number);
  37.        fprintf(file_ptr,"%12.2f",wage);
  38.        fprintf(file_ptr,"%16.1f",hours);
  39.  
  40.        pay = wage*hours;
  41.       fprinf(file_ptr,"%12.2f",pay);
  42.     }
  43.     return 0;
  44. }
  45. There are obvious details that I have left out such as the col heading 
  46. and the stuff, I do not think that they are that important to the 
  47. problem. What I cannot get is by coing into Explorer a print out of the 
  48. dat in the file out.txt.
  49. I check it before I print and it does not even change. Can anyone see 
  50. what is missing. This program is complete as I have compiled it.
  51. Thanks for any help. 
  52. BTW, this compiler is new for me as is the language. I have no idea were 
  53. to look for usable examples to this problem in the Borland manuals.   
  54.